package dxp;

public   class   CRC16 
{ 

        public   CRC16() 
        { 
                value   =   0; 
        } 

        public   void   update(byte   byte0) 
        { 
                int   i   =   byte0; 
                for(int   k   =   7;   k   >=   0;   k--) 
                { 
                        i   <<=   1; 
                        int   j   =   i   >>>   8   &   1; 
                        if((value   &   32768)   !=   0) 
                                value   =   (value   <<   1)   +   j   ^   4129; 
                        else 
                                value   =   (value   <<   1)   +   j; 
                } 

                value   =   value   &   65535; 
        } 

        public   void   reset() 
        { 
                value   =   0; 
        } 

        public   int   value; 
} 
